import request from '../../utils/requestsph';
import { userRegiMode, userLogMode, userMode } from './model/loginMode'

enum loginApi {
  registerApi = '/api/user/passport/register',
  loginApi = '/api/user/passport/login',
  logoutApi = '/api/user/passport/logout',
  getcode = '/api/user/passport/sendCode',
  getuserInfo = '/api/user/passport/auth/getUserInfo'

}

export const postRegister = (user: userRegiMode) => request.post<any, any>(loginApi.registerApi, user)
export const postLogin = (user: userLogMode) => request.post<any, userMode>(loginApi.loginApi, user)
export const getLogout = () => request.get<any, any>(loginApi.logoutApi)
export const getCode = (phone: string) => request.get<any, any>(`${loginApi.getcode}/${phone}`)
export const getuserInfo = () => request.get<any, any>(loginApi.getuserInfo)


